<?php
	header("Content-Type: text/html;charset=utf-8"); 
	include("../function/_nosql.php");
	include("../function/function.php");
	include("../_include.user.judge2.php");
	$URL = $_SERVER['REQUEST_URI'];
	$newsid = chkstr(trim($_REQUEST['newsid']));
	if(is_numeric($newsid)){
		$sql="select * from kboy_forum_travel where id='$newsid'";
		$rows=mysql_query($sql);
		$nums=mysql_num_rows($rows);
		if($nums>0){
			    $rs=mysql_fetch_array($rows);
				$id = $rs['id'];
				$travel_title = $rs['travel_title'];
				$uid = $rs['uid'];
				$travel_content = $rs['travel_content'];
				$travel_best = $rs['travel_best'];
				$travel_addtime = $rs['travel_addtime'];
				mysql_query("update kboy_forum_travel set travel_hit = travel_hit + 1 where id=$newsid");
		}else{

			echo erro("该信息不存在或已被删除1");

		}
	}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <title>社区内容</title>
    <link rel="stylesheet" href="css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
    <link rel="stylesheet" type="text/css" href="css/shequ.css"/>
    <link rel="stylesheet" type="text/css" href="css/smohan.face.css"/>
    <script type="text/javascript" src="../js/baidutongji.js"></script>
    <script src="./js/jquery-1.10.2.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<div id="wrap">
		<header>
				<div class="header">
					<div class="h-logo"><img src="./image/logo.png"></div>
					<div class="h-panel">
						<img src="image/top_pic1.png">
						<img src="image/top_pic2.png">
					</div>
				</div>
				<nav>
					<a href="index.php">首页</a>
					<a href="huodong.php">活动</a>
					<a href="">资讯</a>
					<a href="shequ.php">社区</a>
					<a href="">步道</a>
				</nav>
			</header>
		<main>
		    <div class="sq-d-inner">
		    	<div class="sq-d-title">
                    <h3><?php echo $travel_title; ?></h3>
                    <div class="editor-inner">
                        <span class="editor">作者：<a href="forum_active.php?uid=<?php echo $uid; ?>"><?php echo getClassName("kboy_user","user_nickname","uid = '$uid'"); ?></a></span>
                        <span class="date"><?php echo date('Y年m月d日',strtotime($travel_addtime,time()));?></span>
                    </div>
                </div>
                <div class="sq-d-text">
                	<?php echo $travel_content; ?>
                </div>
                <div class="sq-bd-l1" id="pinglunmao">
                	<div class="post-container" name="container_tiezi" id="container_tiezi">
						<input type="hidden" name="tid" value="215">
							<div class="sq-editor-cont">
									<div class="huifu_one" contenteditable="true" ></div>
								<div class="sq-editor-ft" style="position:relative;">
									<div class="sq-editor-attach">
										<ul>
											<li>
											    <a href="javascript:;">表情<span class="face-icon1" style="font-size: 22px;font-family: '微软雅黑';">☺</span></a>
											</li>
										</ul>
									</div>
									<div class="sq-editor-op"><a href="javascript:;"  name="mao-biao" class="btn-posts" >发 表</a></div>
									<input type="hidden" name="tid" value="<?php echo $id;?>">
									                <div id="SmohanFaceBox" style="overflow: hidden;top:30px;">
                                                    	<span class="Corner" style="left:25px;"></span>
                                                    	<div class="Content">
                                                    		<h3><span>常用表情</span><a class="close" title="关闭"></a></h3>
                                                    		<ul>
                                                    			
                                                    		</ul>
                                                    	</div>
                                                    </div>
								</div>
								<div class="sq-editor-pics">
									<ul class="clearfix">
									</ul>
								</div>
							</div>
                    </div>
                    <div class="sp-huifu-zx">
                    	<div class="huifu-zx">
                    		<p>最新评论 <span>总共<a href="javascript:;"><?php echo mysql_num_rows(mysql_query("select * from kboy_forum_travel_message where tid = '$id'")); ?></a>条评论</span></p>
                    	</div>
                    	<?php
                    	                        function ping($id){
        	                    					$sql = "select * from kboy_forum_travel_message where pid = '$id' order by id desc";
                            						$rows=mysql_query($sql);
                            						
                            						$fun_nums = mysql_num_rows($rows);
                            						if($rows > 0){
                            						   while($rs=mysql_fetch_array($rows)){ 
        												$piduid = getClassName("kboy_forum_travel_message","uid","id =".$rs["pid"]);
        												if($piduid == 0){
        												    $pidnick = getClassName("kboy_forum_travel_message","youkeip","id =".$rs["pid"])."游客";
        												}else{
        												    $pidnick = getClassName("kboy_user","user_nickname","uid =".$piduid);
        												}
        												if($rs['uid']==0){
        												    $images = "/images/lvyou.jpg";
        												    $nickname = $rs["youkeip"]."游客";
        												    
        												}else{
        												     $images = getClassName("kboy_user","user_face","uid =".$rs["uid"]);
        												     $nickname = getClassName("kboy_user","user_nickname","uid =".$rs["uid"]);
        												}
        												echo '<div class="sp-huifu huifu-left">';	
        												echo '<img  class="sp-huifu-pic" src="'.$images.'"/>';
        												echo '<div class="sp-huifu-p">';
        												echo '<p class="sp-huifu-txt"> <span class="huifu-name">'.$nickname.'：</span></p>';
        												echo '<p class="sp-huifu-txt">回复@<span class="huifu-name" style="color:#d85803;">'.$pidnick.'</span>：'.$rs["news_text"].'</p>';
        												echo '<p class="sp-huifu-time">'.$rs["news_addtime"].'<a href="javascript:;" class="huifu-aa">回复</a></p>';
        												echo '<div class="huifu">';
        												echo '<div>回复@<span style="color:#d85803;">'.$pidnick.'</span>：</div>';
        												echo '<div class="huifu_one" contenteditable="true" ></div>';
        												echo '<div class="sq-editor-ft" style="position:relative;"><div class="sq-editor-attach"><ul><li><a href="javascript:;">表情<span class="face-icon1" style="font-size: 22px;font-family: "微软雅黑";">☺</span></a></li></ul></div><div class="sq-editor-op"><a href="javascript:;"  name="mao-biao" class="btn-post">发 表</a></div>';
        												echo '<input type="hidden" name="id" value="'.$rs['id'].'">';
        												echo '<input type="hidden" name="tid" value="'.$rs['tid'].'">';
        												echo '<div id="SmohanFaceBox" style="overflow: hidden;top:30px;"><span class="Corner" style="left:25px;"></span><div class="Content"><h3><span>常用表情</span><a class="close" title="关闭"></a></h3><ul></ul></div></div>';
        												echo '</div></div>';
        												echo '</div></div>';
        											    ping($rs['id']);
        											    } 
                            						}
        	                    				}
                    		$sql = "select * from kboy_forum_travel_message where pid = 0 and tid = '$id' order by id desc";
                    		$rows=mysql_query($sql);
							while($rs=mysql_fetch_array($rows)){
							    
                    	?>
                    	<div class="sp-huifu">
	                    	<img  class="sp-huifu-pic" src="<?php if($rs['uid']==0){ echo "/images/lvyou.jpg"; }else{echo  getClassName("kboy_user","user_face","uid =".$rs['uid']);}  ?>"/>
	                    	<div class="sp-huifu-p">
	                    		<p class="sp-huifu-txt"> <span class="huifu-name"><?php if($rs['uid']==0){ echo $rs['youkeip']."游客"; }else{echo  getClassName("kboy_user","user_nickname","uid =".$rs['uid']);}  ?>：</span></p>
	                    		<p class="sp-huifu-txt"><?php echo $rs['news_text'];?></p>
	                    		<p class="sp-huifu-time"><?php echo $rs['news_addtime']; ?>
	                    		    <a href="javascript:;" class="huifu-aa">回复</a>
	                    		    <a class="huifu-zan" href="javascript:;" data-id="<?php echo $rs['id']?>"  style="color:#d85803;">赞(<span class="num"><?=$rs['news_good']?></span>)</a>
	                    		</p>
	                    		<div class="huifu">
	                    		    <div>回复@<span style="color:#d85803;"><?php if($rs['uid']==0){ echo $rs['youkeip']."游客"; }else{echo  getClassName("kboy_user","user_nickname","uid =".$rs['uid']);}  ?></span>：</div>
	                    		    <div class="huifu_one" contenteditable="true" ></div>
	                    		    <div class="sq-editor-ft" style="position:relative;">
    									<div class="sq-editor-attach">
    										<ul>
    											<li>
    											    <a href="javascript:;">表情<span class="face-icon1" style="font-size: 22px;font-family: '微软雅黑';">☺</span></a>
    											</li>
    										</ul>
    									</div>
    									<div class="sq-editor-op"><a href="javascript:;"  name="mao-biao" class="btn-post">发 表</a></div>
    									<input type="hidden" name="id" value="<?php echo $rs['id'];?>">
    									<input type="hidden" name="tid" value="<?php echo $rs['tid'];?>">
    									            <div id="SmohanFaceBox" style="overflow: hidden;top:30px;">
                                                    	<span class="Corner" style="left:25px;"></span>
                                                    	<div class="Content">
                                                    		<h3><span>常用表情</span><a class="close" title="关闭"></a></h3>
                                                    		<ul>
                                                    			
                                                    		</ul>
                                                    	</div>
                                                    </div>
    								</div>
	                    		 </div>
	                    		<div class="digui_one"><?php ping($rs['id']);?></div>
	                    	</div>
	                    </div>
	                    <?php } ?>
                    </div>
                </div>
		    </div>
		</main>
		<div class="sq-d-pi">
	    	<a href="#pinglunmao" class="">评论<i class="pi_i01"></i></a><a href="javascript:;" class="yjdian">点赞(<span><?php echo $travel_best; ?></span>)<i class="pi_i02"></i></a>
	    </div>
	</div>
</body>
<script type="text/javascript">
    for(var i = 0;i<60;i++){
        var str = '<li><img src="images/face/'+(i+1)+'.gif"></li>';
        $("#SmohanFaceBox .Content ul").append(str);
    }
</script>
<script type="text/javascript">
    var a = 1;
    $(".btn-post").click(function(){
        var id = $(this).parent(".sq-editor-op").siblings("input[name=id]").val();
        var tid = $(this).parent(".sq-editor-op").siblings("input[name=tid]").val();
        var text = $(this).parents(".sq-editor-ft").siblings(".huifu_one").html();
        if(a == 1){
            a=2;
            $.ajax({
    			type:"post",
    			url:"/forum_travelsave.php?action=reply",
    			data:{pid:id,tid:tid,strhtml:text},
    			dataType:"json",
    			success:function(data){
    			    if(data == 1){
    			        location=location
    			    }
    			}
    		});
        }
    })
    $(".btn-posts").click(function(){
        var tid = $(this).parent(".sq-editor-op").siblings("input[name=tid]").val();
        var text = $(this).parents(".sq-editor-ft").siblings(".huifu_one").html();
        if(a == 1){
            a=2;
            $.ajax({
    			type:"post",
    			url:"/forum_travelsave.php?action=add",
    			data:{tid:tid,strhtml:text},
    			dataType:"json",
    			success:function(data){
    			    if(data == 1){
    			        location=location 
    			    }
    			}
    		});
        }
    })
    $(".huifu-aa").click(function(){
        $(this).parents(".sp-huifu-zx").find(".huifu").hide();
        $(this).parent(".sp-huifu-time").siblings(".huifu").toggle();
    })
    $(".sq-editor-attach").click(function(){
        $(this).siblings("#SmohanFaceBox").toggle();
    })
    $(".Content ul li").click(function(){
     var i = $(this).index();
     var str = '<img src="/UploadFile/images/face/'+(i+1)+'.gif">';
     $(this).parents(".sq-editor-ft").siblings(".huifu_one").append(str);
     $(this).parents("#SmohanFaceBox").hide();
    })
    $(".yjdian").click(function(){
        var id = <?php echo $id;?>;
        $.ajax({
            type:"get",
            url:"./youji_zan.php?action=youji",
            data:{id:id},
            dataType:"json",
            success:function(data){
                if(data.id == 1){
                    $(".yjdian span").text(""+data.msg+"")
                }else if(data == 2){
                    alert("您已经点过赞")
                }else if(data == 0){
                    alert("点赞失败")
                }else{
                    alert("请先登陆")
                }
            }
        });
    })
    $(".huifu-zan").click(function(){
       var id = $(this).attr("data-id");
         $.ajax({
            type:"get",
            url:"./youji_zan.php?action=dianzan",
            data:{id:id},
            dataType:"json",
            success:function(data){
                if(data.id == 1){
                    $(".num").text(""+data.msg+"")
                }else if(data == 2){
                    alert("您已经点过赞")
                }else if(data == 0){
                    alert("点赞失败")
                }else{
                    alert("请先登陆")
                }
            }
        });
    })
</script>
</html>	

















